var MyMar,speed;

// $(function (){
	WinLoadRun("");

	if (typeof(TS_navMode)=="undefined"){
		try { console.log("[TS_navMode]未定义"); }catch(e){}
		TS_navMode=21;
	}
	if (TS_navMode>0){
		// 导航菜单子菜单
		$("ul.topnav li.b").on("mouseover", function() {
			if (TS_navMode==21){
				$(this).find("ul.subnav").slideDown('fast').show();

				$(this).on("mouseenter", function() {
				}).on("mouseleave", function(){	
					$(this).find("ul.subnav").slideUp('slow');
				});
			}else if (TS_navMode==26){
				$(this).find("ul.subnav").show();

				$(this).on("mouseenter", function() {
				}).on("mouseleave", function(){	
					$(this).find("ul.subnav").hide();
				});
			}

		}).on("mouseenter", function() {		// 鼠标移到元素上要触发的函数
			$(this).addClass("subhover");
		}).on("mouseleave", function(){			// 鼠标移出元素要触发的函数
			$(this).find("ul.subnav").stop(true,true).slideToggle();
			$(this).removeClass("subhover");
		});
		
	}

	if (webTypeName == "home"){
		// 首页签到按钮变换
		$("#qiandaoBtn").on("mouseenter", function() { 
			$id("qiandaoBtn").src = "inc_img/qiandaoBtn2.png";
		}).on("mouseleave", function(){
			$id("qiandaoBtn").src = "inc_img/qiandaoBtn.png";
		});



		try {
			//横向滚动
			speed=30;
			if ($id('caseMarX').offsetWidth<$id('caseMarX1').offsetWidth){
				$id('caseMarX2').innerHTML=$id('caseMarX1').innerHTML;
				$id('caseMarX3').innerHTML=$id('caseMarX1').innerHTML;
			}
			MyMar=setInterval(Marquee,speed)
			$id('caseMarX').onmouseover=function() { clearInterval(MyMar); }
			$id('caseMarX').onmouseout=function() { MyMar=setInterval(Marquee,speed); }
		}catch (e) {}

		try {
			$('.newMessItem').on('mouseover', function (){
				$(this).addClass('fontU');
				$(this).on("mouseenter", function (){
				}).on("mouseleave", function (){
					$(this).removeClass('fontU');
				});
			});
		}catch (e) {}
	}

// });

	function Marquee(){
		try {
			if($id('caseMarX2').offsetWidth-$id('caseMarX').scrollLeft<=0){
				$id('caseMarX').scrollLeft-=$id('caseMarX1').offsetWidth;
			}else{
				$id('caseMarX').scrollLeft+=1.8;
			}
		}catch (e) { clearInterval(MyMar); }
	}



// 检查投票表单
function CheckVoteForm(formID){
	var isSel=false;
	for (var i=0; i<$name('voteItem'+ formID).length; i++){
		if ($name('voteItem'+ formID)[i].checked){
			isSel = true;
		}
	}
	if (isSel==false){
		alert('请先选择你要投票的选项');return false;
	}

	AjaxPostDeal("voteForm"+ formID);
	return false;
}

// 读取投票结果
function ReadVoteResult(formID){
	$.ajaxSetup({cache:false});
	$.get(webPathPart +"deal.php?mudi=voteResult&dataID="+ formID, function(result){
		if (result.length<50){
			eval(result);
		}else{
			document.getElementById('voteResultBox'+ formID).innerHTML = result;
			$id('voteResultBox'+ formID).style.display="";
			$id('voteBox'+ formID).style.display="none";
		}
	});
	return false;

}

// 关闭投票结果
function CloseVoteResult(formID){
	$id('voteResultBox'+ formID).style.display="none";
	$id('voteBox'+ formID).style.display="";

}
